import java.util.Random;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //猜数字游戏
        Scanner scan=new Scanner(System.in);
        Random random=new Random();
        int randNum= random.nextInt(100);//[0,100)的随机数
        System.out.println("随机数"+randNum);
        while(true){
            System.out.println("输入你要猜的数字");
            int a= scan.nextInt();
            if(a<randNum){
                System.out.println("猜小了");
            }else if(a==randNum){
                System.out.println("猜对了");
                break;
            }else{
                System.out.println("猜大了");
            }
        }
        scan.close();
    }
    public static void main3(String[] args) {
        Scanner scan=new Scanner(System.in);
        while(scan.hasNextInt()){
            int h= scan.nextInt();
            System.out.println(h);
            //ctrl+D结束
        }
    }
    public static void main2(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入你的姓名： ");
        /**
         * nextLine读取一行，可以有空格，如果输入的字符串包含空格，就用这个
         */
        String name=scan.nextLine();
        /**
         * next是遇到空格结束，不会度空格
         */
        //String name=scan.next();
        System.out.println(name);

        System.out.println("请输入你的体重： ");
        double w= scan.nextDouble();
        System.out.println(w);

        scan.close();
    }
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        System.out.println(a);
    }
}
